home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 50
/
Volume 50 - JOGO DISK .iso
/
Games
/
magicheaven.swf
/
scripts
/
__Packages
/
key_func.as
Wrap
Text File
|
2007-10-01
|
3KB
|
109 lines
class key_func extends MovieClip
{
function key_func(arr, OBJ, OBJ2, tmp, func_, time)
{
function funcForObj()
{
if(OBJ.num > 1)
{
if(arguments[2] - arguments[1] > time || arguments[2] - arguments[1] < 0)
{
OBJ2.blo = true;
OBJ.num = 1;
OBJ2.what = 0;
}
else if(arguments[2] - arguments[1] <= time)
{
if(Key.getCode() == arr[OBJ2.what + 1])
{
OBJ2.what = OBJ2.what + 1;
}
if(OBJ2.what == arr.length - 1)
{
func_(this.prop,this.oldVal,this.newVal,this.mid_val);
OBJ.num = 0;
OBJ2.what = 0;
}
}
}
}
super();
var OBJ = new Object();
var OBJ2 = new Object();
OBJ2.key;
OBJ2.what = 0;
OBJ.num = 0;
OBJ.num2 = 0;
OBJ.onKeyDown = function()
{
if(this.once == undefined)
{
this.once = 1;
if(OBJ2.blo == undefined)
{
if(Key.getCode() == arr[this.num])
{
this.num = this.num + 1;
}
}
else if(Key.getCode() == arr[this.num] && OBJ2.blo !== undefined)
{
this.num = this.num + 1;
}
else if(Key.getCode() != arr[this.num])
{
this.num = 0;
delete OBJ2.blo;
}
OBJ2.key = getTimer();
if(this.num > arr.length)
{
this.num = 0;
}
}
};
var cnt = 0;
tmp.onEnterFrame = function()
{
cnt++;
if(cnt > 2)
{
delete OBJ.once;
cnt = 0;
}
};
OBJ.onKeyUp = function()
{
delete this.once;
};
Key.addListener(OBJ);
this.watch(OBJ2,OBJ2.key,"key",funcForObj,0);
}
function watch(Obj, val, string, func, mid_val)
{
if(Obj.once_run == undefined)
{
Obj.once_run = 1;
if(Obj == undefined)
{
Obj = {};
Obj.val;
}
if(mid_val == undefined)
{
mid_val = 0;
}
var _loc4_ = function(prop, oldVal, newVal, mid_val)
{
func(prop,oldVal,newVal,mid_val);
if(newVal == "unwatch")
{
this.m_obj.unwatch();
}
return newVal;
};
Obj.watch(string,_loc4_,mid_val);
}
}
}